package com.yaowk.sfp.eoms.server.service.impl.base;

import java.lang.Long;
import com.yaowk.sfp.eoms.server.dao.NotifyTargetDao;
import com.yaowk.sfp.common.db.BaseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import com.yaowk.sfp.eoms.server.service.INotifyTargetService;
import com.yaowk.sfp.common.db.BaseServiceImpl;
import com.yaowk.sfp.eoms.api.model.NotifyTarget;
import com.yaowk.sfp.eoms.server.entity.EomsNotifyTarget;
import java.lang.String;
import java.lang.Byte;

public abstract class NotifyTargetServiceBase extends BaseServiceImpl<NotifyTarget, EomsNotifyTarget, Long> implements INotifyTargetService {

	@Autowired
	private NotifyTargetDao dao;

	@Override public NotifyTargetDao getDao() {
	return dao;
	}

	@Override
	public NotifyTarget entity2Model(EomsNotifyTarget entity) {
		NotifyTarget model = null;
		if(isNotEmpty(entity)){
			model = new NotifyTarget();
			model.setId(entity.getId());
			model.setTarget(entity.getTarget());
			model.setType(entity.getType());
		}
		return model;
	}

	@Override
	public EomsNotifyTarget model2Entity(NotifyTarget model) {
		EomsNotifyTarget entity = null;
		if(isNotEmpty(model)){
			entity = new EomsNotifyTarget();
			entity.setId(model.getId());
			entity.setTarget(model.getTarget());
			entity.setType(model.getType());
		}
		return entity;
	}

	@Override
	public EomsNotifyTarget updateParams(NotifyTarget model) {
		EomsNotifyTarget entity = dao.findOne(model.getId());
		if(isNotEmpty(model.getTarget()))
			entity.setTarget(model.getTarget());
		if(isNotEmpty(model.getType()))
			entity.setType(model.getType());
		return entity;
	}


}